package org.mspring.mlog.service;

import java.util.Date;

import org.mspring.mlog.dao.AdDao;
import org.mspring.mlog.entity.Ad;
import org.mspring.platform.dao.support.Page;
import org.mspring.platform.dao.support.query.QueryCriterion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * @author Gao Youbo
 * @since 2013-06-18 16:34:42
 */
@Service
public class AdService {
    @Autowired
    private AdDao adDao;

    /**
     * 创建一个广告
     * 
     * @param ad
     * @return
     */
    public Ad createAd(Ad ad) {
        ad.setCreateTime(new Date());
        return adDao.create(ad);
    }

    public Ad get(Long id) {
        return adDao.get(id);
    }

    public Page<Ad> listPage(QueryCriterion queryCriterion, Page<Ad> adPage) {
        return adDao.listPage(queryCriterion, adPage);
    }

    public void update(Ad ad) {
        adDao.update(ad);
    }

    public void remove(Long... id) {
        adDao.remove(id);
    }

    public void remove(Ad ad) {
        adDao.remove(ad);
    }
}